﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="备件计划录入.aspx.cs" Inherits="syc.Jidong.备件计划录入" %>
<html>
<head>
<title></title>
<style>
#RowList{display:none;}
#Panel5{padding:0px 10px 10px 10px;}
div.AutoComplete_Container{position:absolute; z-index:2;border:solid 1px #dd3333;background-color:#ffffff;padding:1px;font-size:14px;color:#ff0000;}
#AutoComplete_CurrentLine{ background-color:#0000cc;}
tr.AutoComplete_Row{font-size:14px;color:#6f320a;height:22px;cursor:pointer;}
tr.AutoComplete_HotRow{font-size:14px;color:#6f320a; background-color:#ffee88;height:22px;cursor:pointer;}
</style>
</head>
<body>
<script type="text/javascript" language="javascript" src="/common.js"></script>
<form id="form1" runat="server" onsubmit="return(checkInput())">
<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
 InsertCommand="insert into 备件计划(MID,年度,月份,填报单位,填报日期,类别ID,填报数量,计划数量,单价,用途,备注)
 values(@ID,@年度,@月份,@填报单位,@填报日期,@类别ID,@数量,@数量,@单价,@用途,@备注);if @ID=0 begin set @ID=@@IDENTITY; end"
 DeleteCommand="delete from 备件计划 where ID=@ID or MID=@ID;"
ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
    oninserted="SqlDataSource1_Inserted" onselected="SqlDataSource1_Selected">
<SelectParameters>
<asp:Parameter Name="ID" Size="4" DbType="Int32"/>
<asp:Parameter Name="年度" DbType="Int16" Size="2" Direction="Output"/>
<asp:Parameter Name="月份" DbType="Byte"  Size="1" Direction="Output"/>
<asp:Parameter Name="填报单位" DbType="AnsiString" Size="6" Direction="Output"/>
<asp:Parameter Name="填报日期" DbType="Date"  Size="3" Direction="Output"/>
</SelectParameters>
<InsertParameters>
<asp:Parameter Name="ID" Size="4" DbType="Int32" Direction="InputOutput"/>
<asp:Parameter Name="年度" DbType="Int16" Size="2"/>
<asp:Parameter Name="月份" DbType="Byte"  Size="1"/>
<asp:Parameter Name="填报单位" DbType="AnsiString" Size="6"/>
<asp:Parameter Name="填报日期" DbType="Date"  Size="3"/>
<asp:Parameter Name="类别ID" Size="4" DbType="Int32"/>
<asp:Parameter Name="数量" Size="4" DbType="Int32"/>
<asp:Parameter Name="单价" DbType="Decimal" Size="9"/>
<asp:Parameter Name="用途" DbType="String"  Size="40"/>
<asp:Parameter Name="备注" DbType="String"  Size="40"/>
</InsertParameters>
<DeleteParameters>
<asp:Parameter Name="ID" Size="4" DbType="Int32"/>
</DeleteParameters>
</asp:SqlDataSource>

<asp:SqlDataSource ID="SqlDataSource2" runat="server" 
    ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
    SelectCommand="SELECT rtrim(编码) as 编码, rtrim(编码)+':' + 名称 as 名称 FROM 设备编码 where 资产=0 and 编码 like '35%' and len(编码)>2 order by 编码"></asp:SqlDataSource>

<asp:DropDownList ID="RowList" runat="server" DataSourceID="SqlDataSource1" DataTextField="val" DataValueField="txt">
</asp:DropDownList>

<asp:HiddenField ID="Cell_ID" runat="server" Value="" />
<asp:HiddenField ID="Cell_PM" runat="server" Value="" />
<asp:HiddenField ID="Cell_XH" runat="server" Value="" />
<asp:HiddenField ID="Cell_DW" runat="server" Value="" />
<asp:HiddenField ID="Cell_SL" runat="server" Value="" />
<asp:HiddenField ID="Cell_DJ" runat="server" Value="" />
<asp:HiddenField ID="Cell_YT" runat="server" Value="" />
<asp:HiddenField ID="Cell_BZ" runat="server" Value="" />
<asp:Label ID="BillID" runat="server" Text="0" Visible="False"></asp:Label>

<div id="wintop" class="wintop">物资采购计划录入</div>
<asp:Panel ID="Panel1" runat="server" CssClass="panel">
<input type="text" style="display:none;" />
    <asp:Button ID="Button_Save" runat="server" Text="保 存" UseSubmitBehavior="false" 
        CssClass="button" onclick="Button_Save_Click" />
    
    <input type="button" value="计算金额" class="button" onclick="calc();" />
    
    <input type="button" value="追加一行" class="button" onclick="addrow('');" />
    
    <input type="button" value="导出Excel" class="button" onclick="Export();" />

    <input type="button" value="关 闭" class="button" onclick="parent.swin_close();" />

 </asp:Panel>
<asp:Panel ID="Panel2" runat="server" CssClass="panel">
计划年度：<asp:DropDownList ID="NianDu" runat="server" Width="80">
    <asp:ListItem Value="2008">2008</asp:ListItem>
    <asp:ListItem Value="2009">2009</asp:ListItem>
    <asp:ListItem Value="2010">2010</asp:ListItem>
    <asp:ListItem Value="2011">2011</asp:ListItem>
    <asp:ListItem Value="2012">2012</asp:ListItem>
    <asp:ListItem Value="2013">2013</asp:ListItem>
    <asp:ListItem Value="2014">2014</asp:ListItem>
    <asp:ListItem Value="2015">2015</asp:ListItem>
    <asp:ListItem Value="2016">2016</asp:ListItem>
    <asp:ListItem Value="2017">2017</asp:ListItem>
    <asp:ListItem Value="2018">2018</asp:ListItem>
    <asp:ListItem Value="2019">2019</asp:ListItem>
    <asp:ListItem Value="2020">2020</asp:ListItem>
    </asp:DropDownList>
月份：<asp:DropDownList ID="YueFen" runat="server" Width="80">
    <asp:ListItem Value="1">1</asp:ListItem>
    <asp:ListItem Value="2">2</asp:ListItem>
    <asp:ListItem Value="3">3</asp:ListItem>
    <asp:ListItem Value="4">4</asp:ListItem>
    <asp:ListItem Value="5">5</asp:ListItem>
    <asp:ListItem Value="6">6</asp:ListItem>
    <asp:ListItem Value="7">7</asp:ListItem>
    <asp:ListItem Value="8">8</asp:ListItem>
    <asp:ListItem Value="9">9</asp:ListItem>
    <asp:ListItem Value="10">10</asp:ListItem>
    <asp:ListItem Value="11">11</asp:ListItem>
    <asp:ListItem Value="12">12</asp:ListItem>
    </asp:DropDownList>
填报单位：<asp:DropDownList ID="TianBao" runat="server" DataSourceID="SqlDataSource2" Width="160" 
        DataTextField="名称" DataValueField="编码">
    </asp:DropDownList>
填报日期：<asp:TextBox ID="Date1" runat="server" CssClass="textbox" Width="110px"></asp:TextBox><img alt="" src="/Icons/29.png" align="middle" onclick="makecalendar(document.getElementById('Date1').value, document.getElementById('Date1'));" />
<span style="margin-left:10px;"></span>
 </asp:Panel>
<asp:Panel ID="Panel_Msg" runat="server" CssClass="panel2" Visible="false">
    <asp:Label ID="Message" runat="server" Text="" CssClass="prompt"></asp:Label>
</asp:Panel>
<div style="text-align:center;">
<script>    putBillHead();</script>
<asp:Panel ID="Panel5" runat="server">

<style>
tr{height:16pt;}
td.nm{border:.5pt solid #000000;font-size:11pt;text-align:center;}
td.nb{border:none;font-size:11pt;text-align:center;}
div{word-break:break-all;}
</style>
<table id=mt border=0 cellpadding=0 style=border-collapse:collapse>
<tr style=height:24pt>
<td class=nb colspan=9 style=font-size:18pt;>物 资 采 购 计 划 表</td>
</tr>
<tr>
<td class=nb colspan=4 style=text-align:left;>&nbsp;填报单位：<%=this.TianBao.SelectedItem.Text.Split(new char[]{':'})[1] %></td>
<td class=nb colspan=2><%=this.Date1.Text%></td>
<td class=nb colspan=3 style=text-align:right;>编号：SYC/ZJ-SC-01&nbsp;</td>
</tr>
<tr style=height:20pt>
<td class=nm style=width:30pt;>序号</td>
<td class=nm style=width:90pt;>品 名</td>
<td class=nm style=width:90pt;>型 号</td>
<td class=nm style=width:50pt;>单 位</td>
<td class=nm style=width:50pt;>数 量</td>
<td class=nm style=width:60pt;>单价(元)</td>
<td class=nm style=width:80pt;>金额(元)</td>
<td class=nm style=width:90pt;>用 途</td>
<td class=nm style=width:90pt;>备 注</td>
</tr>

<tr>
<td class=nm></td>
<td class=nm></td>
<td class=nm></td>
<td class=nm></td>
<td class=nm></td>
<td class=nm style=text-align:right;>合计：</td>
<td class=nm></td>
<td class=nm></td>
<td class=nm></td>
</tr>

</table>


</asp:Panel>
<script>    putBillFoot();</script>
</div>

</form>

<form id="form2" method="post" action="/PageExport.ashx">
<input type="hidden" name="filename" value="采购计划.xls" />
<input type="hidden" name="content" value="" />
</form>


<script>
    var mt = document.getElementById("mt");
    var rows = 0;

    var TianBao = document.getElementById("TianBao");

    TianBao.onchange = function() {
        mt.rows[1].cells[0].innerHTML = "&nbsp;填报单位：" + TianBao.options[TianBao.selectedIndex].text.split(":",2)[1];
    };
    var Date1 = document.getElementById("Date1");
    Date1.onchange = function() {
        mt.rows[1].cells[1].innerHTML = Date1.value;
    };

    var IDList = new Array();
    //自动完成
    var AutoComplete_Container = document.getElementById("AutoComplete_Container");
    if (!AutoComplete_Container) {//创建容器
        AutoComplete_Container = document.createElement("DIV");
        AutoComplete_Container.id = "AutoComplete_Container";
        AutoComplete_Container.className = "AutoComplete_Container";
        AutoComplete_Container.style.display = "none";
        document.body.appendChild(AutoComplete_Container);
    }
    var AutoComplete_Lists = new Array();
    var AutoComplete_Target = null;
    var AutoComplete_LastValue = "";
    function AutoComplete_SetHotRow(o) {
        var hotrow = document.getElementById("AutoComplete_HotRow");
        hotrow.id = "";
        hotrow.className = "AutoComplete_Row";
        o.id = "AutoComplete_HotRow";
        o.className = "AutoComplete_HotRow";
    }
    function AutoComplete_Select() {
        var hotrow = document.getElementById("AutoComplete_HotRow");
        if (hotrow) {
            var li = AutoComplete_Lists[hotrow.rowIndex].split("\t");
            IDList[AutoComplete_Target.parentNode.parentNode.rowIndex - 3] = li[0];
            AutoComplete_Target.innerHTML = li[1];
            var next = AutoComplete_Target.parentNode.nextSibling;
            next.innerHTML = li[2];
            next = next.nextSibling;
            next.innerHTML = li[3];
            next = next.nextSibling.nextSibling;
            if (li[4] == "0.00") li[4] = "";
            next.innerHTML = "<div tabindex=0 contentEditable style=width:60pt;>" + li[4] + "</div>";
        } 
    }
    function AutoComplete_Response(http) {
        if (http.status != 200) {
            alert("服务器错误: " + http.status + " " + http.statusText);
            return;
        }
        if (http.responseText == "") {
            AutoComplete_Container.innerHTML = "<div style=padding:3px;font-size:14px;>没有查询到您录入的品种"
            + " <input type=button value='新增品种' class='mbutton' onmousedown=parent.swin2_load('/JiDong/备件品种录入.aspx',600,379); /></div>";
        }
        else {
            var className = "AutoComplete_HotRow";
            var rs = http.responseText.split("\n");
            var tmp = "<table>";
            var cs;
            var id = " id=AutoComplete_HotRow";
            for (var i = 0; i < rs.length - 1; i++) {
                AutoComplete_Lists[i] = rs[i];
                cs = rs[i].split("\t");
                tmp += "<tr" + id + " class=" + className + " onmousemove=AutoComplete_SetHotRow(this); onmousedown=AutoComplete_Select();><td style=width:90pt;padding:2px;>"
                    + cs[1] + "</td><td align=center style=width:90pt>"
                    + cs[2] + "</td><td align=center style=width:80pt>"
                    + cs[4] + "/" + cs[3] + "</td></tr>";
                className = "AutoComplete_Row";
                id = "";
            }
            tmp += "</table>";
            AutoComplete_Container.innerHTML = tmp;
        }

        AutoComplete_Container.style.display = "";
        AutoComplete_Container.style.top = (getObjectTop(AutoComplete_Target) + AutoComplete_Target.clientHeight + 2) + "px";
        AutoComplete_Container.style.left = (getObjectLeft(AutoComplete_Target)) + "px";
    };
    function AutoComplete_HideContainer() {
        if (AutoComplete_Target == null) {
            AutoComplete_Container.style.display = "none";
        }
    }
    function AutoComplete_SetValue(value) {
        if (typeof (AutoComplete_Target.value) != "undefined") AutoComplete_Target.value = value;
        else if (typeof (AutoComplete_Target.innerText) != "undefined") AutoComplete_Target.innerText = value;
        else if (typeof (AutoComplete_Target.textContent) != "undefined") AutoComplete_Target.textContent = value;
    }
    function AutoComplete() {
        if (AutoComplete_Target == null) {
            AutoComplete_Container.style.display = "none";
        }
        else if (AutoComplete_Target != document.activeElement) {
            AutoComplete_Target = null;
            setTimeout("AutoComplete_HideContainer()", 100);
        }
        else {

            var txt;
            if (typeof (AutoComplete_Target.value) != "undefined") txt = AutoComplete_Target.value;
            else if (typeof (AutoComplete_Target.innerText) != "undefined") txt = AutoComplete_Target.innerText;
            else if (typeof (AutoComplete_Target.textContent) != "undefined") txt = AutoComplete_Target.textContent;

            txt = txt.replace(/^\s+/, '').replace(/\s+$/, '');
            if (txt == "") {
                AutoComplete_Container.style.display = "none";
            }
            else if (txt != AutoComplete_LastValue) {
                AutoComplete_LastValue = txt;
                var request = createRequest(AutoComplete_Response);
                request.open("GET", encodeURI("/jidong/备件查询.ashx?s=" + txt), true);
                request.send(null);
            }
        }
        setTimeout("AutoComplete()",200);
    }
    document.onkeydown = function(e) {
        if (!e) e = window.event;
        var tag = e.srcElement;
        if (!tag) tag = e.target;
        if (tag.tagName != "DIV") return;
        if (tag == AutoComplete_Target && AutoComplete_Container.style.display != "none") {
            if (e.keyCode != 9) {
                IDList[AutoComplete_Target.parentNode.parentNode.rowIndex - 3] = 0;
                var next = tag.parentNode.nextSibling;
                next.innerHTML = "";
                next = next.nextSibling;
                next.innerHTML = "";
                next = next.nextSibling.nextSibling;
                next.innerHTML = "<div tabindex=0 contentEditable style=width:60pt;></div>";
            }
            if (e.keyCode == 38) {
                var hotrow = document.getElementById("AutoComplete_HotRow");
                if (hotrow) {
                    var lt = hotrow.parentNode.parentNode;
                    hotrow.id = "";
                    hotrow.className = "AutoComplete_Row";
                    if (hotrow.rowIndex > 0) {
                        lt.rows[hotrow.rowIndex - 1].id = "AutoComplete_HotRow";
                        lt.rows[hotrow.rowIndex - 1].className = "AutoComplete_HotRow";
                    }
                    else {
                        lt.rows[lt.rows.length - 1].id = "AutoComplete_HotRow";
                        lt.rows[lt.rows.length - 1].className = "AutoComplete_HotRow";
                    }
                }
            }
            else if (e.keyCode == 40) {
                var hotrow = document.getElementById("AutoComplete_HotRow");
                if (hotrow) {
                    var lt = hotrow.parentNode.parentNode;
                    hotrow.id = "";
                    hotrow.className = "AutoComplete_Row";
                    if (hotrow.rowIndex < lt.rows.length - 1) {
                        lt.rows[hotrow.rowIndex + 1].id = "AutoComplete_HotRow";
                        lt.rows[hotrow.rowIndex + 1].className = "AutoComplete_HotRow";
                    }
                    else {
                        lt.rows[0].id = "AutoComplete_HotRow";
                        lt.rows[0].className = "AutoComplete_HotRow";
                    }
                }
            }
            else if (e.keyCode == 13) {
                AutoComplete_Select();
                e.keyCode = 9;
            }
            else if (e.keyCode == 27) {
                AutoComplete_LastValue = "";
                tag.innerHTML = "";
            }
        }
        else if (e.keyCode == 13) {
            if (tag.parentNode.parentNode.rowIndex == rows + 2 && tag.parentNode.cellIndex == 8) {
                addrow("");
            }
            e.keyCode = 9;
        }

    }
    setTimeout("AutoComplete()", 200);
    //自动完成结束


    function calc() {
        var row;
        var n, p;
        var total = 0;
        for (var i = 3; i < mt.rows.length - 1; i++) {
            row = mt.rows[i];
            n = Number(row.cells[4].innerText || row.cells[4].textContent);
            if (n == NaN) {
                n = -1;
            }

            p = Number(row.cells[5].innerText || row.cells[5].textContent);
            if (p == NaN) {
                p = -1;
            }
            if (n > 0 && p > 0) {
                row.cells[6].innerHTML = n * (p * 1000) / 1000;
                total += n * p;
            }
            else {
                row.cells[6].innerHTML = "";
            }
        }
        mt.rows[mt.rows.length - 1].cells[6].innerHTML = total;
    }

    function addrow(s) {
        rows++;
        var list = s.split("|=*");
        for (var i = 0; i < 8; i++) {
            if (list[i] == null) list[i] = "";
        }
        if (list[0] == "") IDList[rows-1] = 0;
        else IDList[rows - 1] = list[0];
        if (list[3] == -1) list[3] = "";
        if (list[4] == -1) list[4] = "";
        var row = mt.insertRow(rows + 2);

        var col = row.insertCell(-1);
        col.className = "nm";
        col.innerHTML = rows;
        
        col = row.insertCell(-1);
        col.className = "nm";
        col.innerHTML = "<div id=PinMing_" + rows + " tabindex=0 contentEditable style=width:90pt;>" + list[1] + "</div>";
        var pm = document.getElementById("PinMing_" + rows);
        pm.onfocus = function() {
            AutoComplete_LastValue = "";
            AutoComplete_Target = this;
        }
        
        col = row.insertCell(-1);
        col.className = "nm";
        col.innerHTML = list[2];

        col = row.insertCell(-1);
        col.className = "nm";
        col.innerHTML = list[3];

        col = row.insertCell(-1);
        col.className = "nm";
        col.innerHTML = "<div tabindex=0 contentEditable style=width:50pt;>" + list[4] + "</div>";

        col = row.insertCell(-1);
        col.className = "nm";
        col.innerHTML = "<div tabindex=0 contentEditable style=width:60pt;>" + list[5] + "</div>";

        col = row.insertCell(-1);
        var n, p;
        n = Number(list[4]);
        if (n == NaN) {
            n = -1;
        }

        p = Number(list[5]);
        if (p == NaN) {
            p = -1;
        }

        if (n > 0 && p > 0) col.innerHTML = n * (p * 1000) / 1000;
        else col.innerHTML = "";
        col.className = "nm";
        
        col = row.insertCell(-1);
        col.className = "nm";
        col.innerHTML = "<div tabindex=0 contentEditable style=width:90pt;>" + list[6] + "</div>";

        col = row.insertCell(-1);
        col.className = "nm";
        col.innerHTML = "<div tabindex=0 contentEditable style=width:90pt;>" + list[7] + "</div>";
    }

    var RowList = document.getElementById("RowList");
    for (var i = 0; i < RowList.options.length; i++) {
        addrow(RowList.options[i].text);
    }

    for (var i = rows; i < 15; i++) {
        addrow("");
    }
    calc();
    setTimeout("document.getElementById('PinMing_1').focus();", 100);
    //输入检测
    function checkInput() {
        calc();
        var txt;
        var Cell_ID = document.getElementById("Cell_ID");
        var Cell_PM = document.getElementById("Cell_PM");
        var Cell_XH = document.getElementById("Cell_XH");
        var Cell_DW = document.getElementById("Cell_DW");
        var Cell_SL = document.getElementById("Cell_SL");
        var Cell_DJ = document.getElementById("Cell_DJ");
        var Cell_YT = document.getElementById("Cell_YT");
        var Cell_BZ = document.getElementById("Cell_BZ");

        Cell_ID.value = "";
        Cell_PM.value = "";
        Cell_XH.value = "";
        Cell_DW.value = "";
        Cell_SL.value = "";
        Cell_DJ.value = "";
        Cell_YT.value = "";
        Cell_BZ.value = "";
        
        var n, p;
        
        for (var i = 3; i < mt.rows.length - 1; i++) {
            if (IDList[i - 3] > 0) {

                Cell_ID.value += "|" + IDList[i - 3];

                txt = mt.rows[i].cells[1].innerText;
                if (txt == null) txt = mt.rows[i].cells[1].textContent;
                txt = txt.replace(/^\s+/, '').replace(/\s+$/, '');
                Cell_PM.value += "|=*" + txt;


                txt = mt.rows[i].cells[2].innerText;
                if (txt == null) txt = mt.rows[i].cells[2].textContent;
                txt = txt.replace(/^\s+/, '').replace(/\s+$/, '');
                Cell_XH.value += "|=*" + txt;


                txt = mt.rows[i].cells[3].innerText;
                if (txt == null) txt = mt.rows[i].cells[3].textContent;
                txt = txt.replace(/^\s+/, '').replace(/\s+$/, '');
                Cell_DW.value += "|=*" + txt;
            
            
                txt = mt.rows[i].cells[4].innerText;
                if (txt == null) txt = mt.rows[i].cells[4].textContent;
                txt = txt.replace(/^\s+/, '').replace(/\s+$/, '');
                if (txt == "") continue;
                Cell_SL.value += "|" + txt;

                txt = mt.rows[i].cells[5].innerText;
                if (txt == null) txt = mt.rows[i].cells[5].textContent;
                txt = txt.replace(/^\s+/, '').replace(/\s+$/, '');
                Cell_DJ.value += "|" + txt;

                txt = mt.rows[i].cells[7].innerText;
                if (txt == null) txt = mt.rows[i].cells[7].textContent;
                txt = txt.replace(/^\s+/, '').replace(/\s+$/, '');
                Cell_YT.value += "|=*" + txt;

                txt = mt.rows[i].cells[8].innerText;
                if (txt == null) txt = mt.rows[i].cells[8].textContent;
                txt = txt.replace(/^\s+/, '').replace(/\s+$/, '');
                Cell_BZ.value += "|=*" + txt;
            }
        }

    }

    //导出Excel
    function Export() {
        form2.content.value =
"<html xmlns:o='urn:schemas-microsoft-com:office:office'\nxmlns:x='urn:schemas-microsoft-com:office:excel'\nxmlns='http://www.w3.org/TR/REC-html40'>\n<head>\n<meta http-equiv=Content-Type content='text/html; charset=utf-8'>\n<style>\n<!--table\n@page\n{mso-header-data:;\nmso-footer-data:;\nmargin:.79in .31in .79in .31in;\nmso-header-margin:.51in;\nmso-footer-margin:.51in;\nmso-page-orientation:landscape;\nmso-horizontal-page-align:center;\n}\n-->\n</style>\n<!--[if gte mso 9]><xml>\n<x:ExcelWorkbook>\n<x:ExcelWorksheets>\n<x:ExcelWorksheet>\n<x:Name>采购计划</x:Name>\n<x:WorksheetOptions>\n<x:DefaultRowHeight>285</x:DefaultRowHeight>\n<x:Print>\n<x:ValidPrinterInfo/>\n<x:Scale>100</x:Scale>\n<x:PaperSizeIndex>9</x:PaperSizeIndex>\n<x:HorizontalResolution>200</x:HorizontalResolution>\n<x:VerticalResolution>200</x:VerticalResolution>\n</x:Print>\n<x:Selected/>\n<x:Panes>\n<x:Pane>\n<x:Number>3</x:Number>\n<x:ActiveRow>0</x:ActiveRow>\n<x:ActiveCol>0</x:ActiveCol>\n</x:Pane>\n</x:Panes>\n</x:WorksheetOptions>\n</x:ExcelWorksheet>\n</x:ExcelWorkbook>\n</xml><![endif]-->\n</head>\n<body>"
            + document.getElementById("Panel5").innerHTML.replace(/<div [^>]*>/gi, "").replace(/<\/div>/gi, "");
+"</body></html>";
        form2.submit();
    }


</script>
</body>
</html>